<?php
/* @var $this NewsController */
/* @var $model News */

$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'资讯管理'=>array($this->pre_module_url.'/news/admin'),
	'回收站'=>array($this->pre_module_url.'/newsRecycle/index'),
);


?>

<div class="pro_filter c_f">
	<div class="filter f_l">
		<?php $form=$this->beginWidget('CActiveForm', array(
			'action'=>Yii::app()->createUrl($this->route),
			'method'=>'get',
		)); ?>
			<label class="">选择类目：</label>
			<span id="catagory">
				<select name="Product[cateid1]" class="level_1 s_ipt w_120" id="dataProductIndustryId1" ></select>
				<select name="Product[cateid2]" class="level_2 s_ipt w_120" id="dataProductIndustryId2"></select>
				<select name="Product[cateid3]" class="level_3 s_ipt w_120" id="dataProductIndustryId3" ></select>
			</span>
			<label class="">发布者：</label>
			<?php echo $form->dropDownList($model,'author_type',News::model()->getAuthorType(),array('class'=>'s_ipt w_120'))?>
			<?php echo CHtml::textField('News[zne_title]',empty($model->zne_title)?'输入信息标题关健字':$model->zne_title,array('class'=>'t_ipt w_170','onfocus'=>"if (value =='输入信息标题关健字'){value =''}",'onblur'=>"if (value ==''){value='输入信息标题关健字'}"))?>
			<button class="mem_bgx mem_btn01" type="submit" name="">查找</button>
		<?php $this->endWidget(); ?>
	</div>
</div>

<table class="list_table list_table2" width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<th width="" class="pl15">信息标题</th>
		<th width="13%">信息分类</th>
		<th width="13%">发布者</th>
		<th width="15%">发布时间</th> 
		<th width="12%">操作</th>                                                    
	</tr>
</table>
<?php   
$this->widget('zii.widgets.CListView', array(  
    'dataProvider'=>$model->search(),  
    'itemView'=>'../news/_view',    
    'emptyText'=>'暂时没有数据',  
    'selectAll'=>array('ids[]','id[]'), 
	'itemsTagName'=>'table',
	'itemsOptions'=>array('class'=>'list_table list_table2','width'=>'100%','cellpadding'=>0,'cellspacing'=>0), 
    'artLink'=>array(  
        //批量还原
        array(Yii::t('adm','Restore All'),$this->pre_module_url.'/newsRecycle/restore','确认还原所选项目吗！'),  
		//批量删除
		array(Yii::t('adm','Delete All'),$this->pre_module_url.'/newsRecycle/delete','确认批量删除选中项目！'),
    ),  
    'viewData'=>array('recycle'=>'recycle'),
    ));  
?> 

<script type="text/javascript" src="/js/multi_select.js"></script>
<script type="text/javascript">
$.getJSON('/cache/GetNewsCat',function(json){
	var options	= {data	: json};
	var loc = new multi_select(options);
	loc.bind('#catagory .level_1','<?php if(!empty($model->newscat)) echo ($model->newscat->znc_patentid==0)?$model->newscat->znc_id:(($model->newscat->znc_topid==0)?$model->newscat->znc_patentid:$model->newscat->znc_topid)?>');
	loc.bind('#catagory .level_2','<?php if(!empty($model->newscat)) echo ($model->newscat->znc_patentid==0)?'':(($model->newscat->znc_topid==0)?$model->newscat->znc_id:$model->newscat->znc_patentid)?>');
	loc.bind('#catagory .level_3','<?php if(!empty($model->newscat)) echo ($model->newscat->znc_patentid==0)?'':(($model->newscat->znc_topid==0)?'':$model->newscat->znc_patentid)?>');
});
//载入页面显示分类
$(document).ready(function(){
	if($('.level_2').find('option').length<2){
		$('.level_2').hide();
		$('.level_1').attr('name','News[znc_id]');
		$('.level_2').attr('name','');
		$('.level_3').attr('name','');
	}else{
		$('.level_2').show();
		$('.level_1').attr('name','');
		$('.level_2').attr('name','News[znc_id]');
		$('.level_3').attr('name','');
	}
	if($('.level_3').find('option').length<2){
		$('.level_3').hide();
		$('.level_2').attr('name','News[znc_id]');
		$('.level_3').attr('name','');
	}else{
		$('.level_3').show();
		$('.level_2').attr('name','');
		$('.level_3').attr('name','News[znc_id]');
	}
});

//选行分类 ，链动隐藏
$('.level_1').bind('blur',function(){
	if($('.level_2').find('option').length<2){
		$('.level_2').hide();
		$('.level_1').attr('name','News[znc_id]');
		$('.level_2').attr('name','');
		$('.level_3').attr('name','');
	}else{
		$('.level_2').show();
		$('.level_1').attr('name','');
		$('.level_2').attr('name','News[znc_id]');
		$('.level_3').attr('name','');
	}
	$('.level_3').hide();
});
$('.level_2').bind('blur',function(){
	if($('.level_3').find('option').length<2){
		$('.level_3').hide();
		$('.level_2').attr('name','News[znc_id]');
		$('.level_3').attr('name','');
	}else{
		$('.level_3').show();
		$('.level_2').attr('name','');
		$('.level_3').attr('name','News[znc_id]');
	}
});
</script>